/*
 *  Broadcaster.h
 *  xGPS
 *
 *  Created by Miguel Arroz on 10/06/30.
 *  Copyright Miguel Arroz. All rights reserved.
 *
 */

#ifndef __BROADCASTER_H
#define __BROADCASTER_H

#include "xGPS.h"
#include <sys/socket.h>

typedef struct {
	double latitude;
	double longitude;
	float heading;
} xGPSData;

void startBroadcasting();
void stopBroadcasting();
float broadcastCallback ( float inElapsedSinceLastCall, float inElapsedTimeSinceLastFlightLoop, int inCounter, void *inRefcon);	
void initDataRefs();
xGPSData getCurrentData();
void printData( xGPSData data );
void openSocket();
void closeSocket();
void adjustSock();
void serializeData( xGPSData data );
void sendBufferToNetwork();
void tuneBroadcaster( long randNum, struct sockaddr_storage addr, socklen_t addrLen );
void initBroadcaster();
void sendAck();
void* startPingerThread( void *ptr );

#endif